import java.util.HashMap;
import java.util.Map;

// 书籍工厂类（享元工厂类）
class BookFlyweightFactory {
    private static final Map<String, Book> books = new HashMap<>();

    public static Book getBook(String bookNumber) {
        Book book = books.get(bookNumber);
        if (book == null) {
            book = new ConcreteBook(bookNumber);
            books.put(bookNumber, book);
            System.out.println("创建了书籍：" + bookNumber);
        } else {
            System.out.println("重复使用书籍：" + bookNumber);
        }
        return book;
    }
}